package unitTest;

import java.rmi.RemoteException;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import error.InformationException;

import junit.framework.TestCase;
import vo.StudentVO;
import vo.TeacherVO;
import UserBL.Student;
import UserBL.UserController;

public class UserTest extends TestCase{

	private UserController user;
	
	
	@Before
    public void setUp() throws Exception {
		user=new UserController();
    }

    @After
    public void tearDown() throws Exception {
    }
	
	@Test
	/*
	public void testLogin(){
		StudentVO aim=new StudentVO();
		StudentVO re=new StudentVO();
		aim.ID="121250080";
		aim.code="123456";
		try {
			aim=user.login(aim);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			re=user.getStudent("121250080");
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Assert.assertEquals(re.department, aim.department);
	}
	
	
	public void testTeacherLogin(){
		TeacherVO aim=new TeacherVO();
		TeacherVO re=new TeacherVO();
		aim.ID="121250002";
		aim.code="123456";
		try {
			aim=user.login(aim);
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			re=user.getTeacher("121250002");
		} catch (RemoteException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		Assert.assertEquals(re.department, aim.department);
	}
	*/
	
	public void testStudentRegister(){
		StudentVO aim=new StudentVO();
		aim.ID="121250079";
		try
		{
			Assert.assertTrue(user.registerStudent(aim));
		} catch (InformationException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
